//
//  WYFollowMeCell.m
//  Boss
//
//  Created by admin on 2018/8/23.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYFollowMeCell.h"
@interface WYFollowMeCell()

@property (strong, nonatomic) IBOutlet UIImageView *userImageView;
@property (strong, nonatomic) IBOutlet UILabel *nameLabel;
@property (strong, nonatomic) IBOutlet UILabel *timeLabel;
@property (strong, nonatomic) IBOutlet UIButton *followBtn;

@property (strong, nonatomic) IBOutlet UIImageView *vipImageView;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *imageViewWidth;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *followLeading;

@end
@implementation WYFollowMeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self.userImageView setCornerRadius:20.f];
    [self.followBtn setBorderWithWidth:kLineHeight andColor:kColorMainColor];
    [self.followBtn setCornerRadius:4.f];
    
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)setFollow:(WYFollowMeModel *)follow
{
    _follow =follow;
    
    [self.userImageView sd_setImageWithURL:[NSURL URLWithString:follow.userUrl] placeholderImage:[UIImage imageNamed:@"ic_defult_avatar"]];
    self.nameLabel.text = follow.userName;
    self.timeLabel.text = [NSString compareTimeWithBossTime:follow.createTime];
    [self.vipImageView showVipImageViewStatusWithVipId:follow.vipId];
    if (follow.vipId.integerValue) {
        self.imageViewWidth.constant = 18;
        self.followLeading.constant = 10;
    }else{
        self.imageViewWidth.constant = 0;
        self.followLeading.constant = 0;
    }
    
    
    if (follow.attentionState.integerValue) {
        [self.followBtn setTitle:@"已关注" forState:UIControlStateNormal];
        [self.followBtn setBorderWithWidth:kLineHeight andColor:[UIColor hexStringToColor:@"#999999" alpha:1.0]];
        [self.followBtn setTitleColor:[UIColor hexStringToColor:@"#999999" alpha:1.0] forState:(UIControlStateNormal)];
        self.followBtn.userInteractionEnabled = NO;
    }else{
        [self.followBtn setTitle:@"关注" forState:UIControlStateNormal];
        [self.followBtn setBorderWithWidth:kLineHeight andColor:kColorMainColor];
        [self.followBtn setTitleColor:kColorMainColor forState:(UIControlStateNormal)];
        self.followBtn.userInteractionEnabled = YES;
    }
}
- (IBAction)clickFollowBtn:(id)sender {
    if ([self.delegate respondsToSelector:@selector(clickStateAction:)]) {
        [self.delegate clickStateAction:self];
    }
    
    
    
}
- (IBAction)clickImageViewAcion:(id)sender {
    
    if ([self.delegate respondsToSelector:@selector(jumpToHomePageWithUserId:)]) {
        [self.delegate jumpToHomePageWithUserId:_follow.userId];
    }
    
    
    
}



@end
